home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / a_utils / perl / msds-prl / ptchds19.zoo / README_msdos < prev    next >
Text File  |  1992-02-23  |  19KB  |  475 lines

  1. MS-DOS patches to perl.
  2. Apply this patch to the standard perl source, version 4, patch level 19,
  3. using "patch -p."  Do this in the root directory of the perl source
  4. distribution.
  5.  
  6. You can cat all these patches together and pipe the output to patch -p.
  7.  
  8. Len Reed
  9. Holos Software, Inc.
  10. ..!gatech!holos0!lbr
  11. holos0!lbr@gatech.edu
  12. --------------------------------------
  13. *** msdos/README.msdos.old    Wed Apr 17 17:16:58 1991
  14. --- msdos/README.msdos    Sun Feb 23 10:52:04 1992
  15. ***************
  16. *** 1,195 ****
  17. !            Notes on the MS-DOS Perl port
  18.   
  19. -             Diomidis Spinellis
  20. -              (dds@cc.ic.ac.uk)
  21.   
  22. ! [0. First copy the files in the msdos directory into the parent
  23. ! directory--law]
  24.   
  25. ! 1.  Compiling.
  26.   
  27. -      Perl has been compiled under MS-DOS using the Microsoft
  28. - C  compiler  version 5.1.  Before compiling install dir.h as
  29. - <sys/dir.h>.  You will need a Unix-like make  program  (e.g.
  30. - pdmake) and something like yacc (e.g. bison).  You could get
  31. - away by running yacc and dry running make on  a  Unix  host,
  32. - but  I  haven't tried it.  Compilation takes 12 minutes on a
  33. - 20MHz 386 machine (together with formating the  manual),  so
  34. - you  will probably need something to do in the meantime. The
  35. - executable is 272k and the top level directory needs 1M  for
  36. - sources  and  about the same ammount for the object code and
  37. - the executables.
  38.   
  39. !      The makefile will compile glob for you which  you  will
  40. ! need  to  place somewhere in your path so that perl globbing
  41. ! will work correctly.  I have not tried all the tests or  the
  42. ! examples,  nor the awk and sed to Perl translators.  You are
  43. ! on your own with them.  In the eg directory I have  included
  44. ! an  example  program  that uses ioctl to display the charac-
  45. ! teristics of the storage devices of the system.
  46.   
  47. - 2.  Using MS-DOS Perl
  48.   
  49. !      The MS-DOS version of perl has most of the  functional-
  50. ! ity of the Unix version.  Functions that can not be provided
  51. ! under  MS-DOS  like  sockets,  password  and  host  database
  52. ! access,  fork  and wait have been ommited and will terminate
  53. ! with a fatal error.  Care has been taken  to  implement  the
  54. ! rest.   In particular directory access, redirection (includ-
  55. ! ing pipes, but excluding the pipe function),  system,  ioctl
  56. ! and sleep have been provided.
  57.   
  58. ! [Files currently can be edited in-place provided you are cre-
  59. ! ating  a  backup.   However, if the backup coincidentally has 
  60. ! the same name as the original, or  if  the  resulting  backup 
  61. ! filename  is invalid, then the file will probably be trashed.
  62. ! For example, don't do
  63.   
  64. !     perl -i~ script makefile
  65. !     perl -i.bak script file.dat
  66.   
  67. ! because  (1)  MS-DOS treats "makefile~" and "makefile" as the
  68. ! same filename, and (2) "file.dat.bak" is an invalid filename.
  69. ! The  files  "makefile"  and  "file.dat" will probably be lost 
  70. ! forever.  Moral of the story:   Don't  use  in-place  editing 
  71. ! under MS-DOS. --rjc]
  72.   
  73. ! 2.1.  Interface to the MS-DOS ioctl system call.
  74.   
  75. -      The function code of the  ioctl  function  (the  second
  76. - argument) is encoded as follows:
  77.   
  78. ! - The lowest nibble of the function code goes to AL.
  79. ! - The two middle nibbles go to CL.
  80. ! - The high nibble goes to CH.
  81.   
  82. !      The return code is -1 in the case of an  error  and  if
  83. ! successful:
  84.   
  85. ! - for functions AL = 00, 09, 0a the value of the register DX
  86. ! - for functions AL = 02 - 08, 0e the value of the register AX
  87. ! - for functions AL = 01, 0b - 0f the number 0.
  88.   
  89. !      See the perl manual for instruction on how  to  distin-
  90. ! guish between the return value and the success of ioctl.
  91.   
  92. !      Some ioctl functions need a number as the  first  argu-
  93. ! ment.   Provided  that  no  other files have been opened the
  94. ! number  can  be   obtained   if   ioctl   is   called   with
  95. ! @fdnum[number]  as  the  first  argument after executing the
  96. ! following code:
  97.   
  98. !         @fdnum = ("STDIN", "STDOUT", "STDERR");
  99. !         $maxdrives = 15;
  100. !         for ($i = 3; $i < $maxdrives; $i++) {
  101. !                 open("FD$i", "nul");
  102. !                 @fdnum[$i - 1] = "FD$i";
  103. !         }
  104.   
  105. ! 2.2.  Binary file access
  106.   
  107. !      Files are opened in text mode by default.   This  means
  108. ! that  CR LF pairs are translated to LF.  If binary access is
  109. ! needed the `binary'  function  should  be  used.   There  is
  110. ! currently  no  way to reverse the effect of the binary func-
  111. ! tion.  If that is needed close and reopen the file.
  112.   
  113. - 2.3.  Interpreter startup.
  114.   
  115. !      The effect of the Unix #!/bin/perl interpreter  startup
  116. ! can  be  obtained  under  MS-DOS by giving the script a .bat
  117. ! extension and using the following lines on its begining:
  118.   
  119. !         @REM=("
  120. !         @perl %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  121. !         @end ") if 0 ;
  122.   
  123. ! (Note that you will probably want an absolute path name in
  124. ! front of %0.bat).
  125.   
  126. !                 March 1990
  127.   
  128. !                 Diomidis Spinellis <dds@cc.ic.ac.uk>
  129. !                 Myrsinis 1
  130. !                 GR-145 62 Kifissia
  131. !                 Greece
  132.   
  133. ! --------------------------------------------------------------------------
  134.   
  135. !     Revisions to the MS-DOS support in Perl 4.0
  136. !     Tom Dinger, 18 March 1991
  137.   
  138. ! The DOS compatibility added to Perl sometime in release 3.x was not
  139. ! maintained, and Perl as distributed could not be built without changes.
  140.   
  141. - Both myself and Len Reed more or less "rediscovered" how to get Perl built
  142. - and running reliably for MS-DOS, using the Microsoft C compiler.  He and I
  143. - have communicated, and will be putting together additional patches for the
  144. - DOS version of Perl.
  145.   
  146. ! 1. Compiling Perl
  147.   
  148. !     For now, I have not supplied a makefile, as there is no standard for
  149. !     make utilities under DOS.  All the files can be compiled with Microsoft
  150. !     C 5.1, using the switches "-AL -Ox" for Large memory model, maximum
  151. !     optimization (this turned out a few code generation bugs in MSC 5.1).
  152. !     The code will also compile with MSC 6.00A, with the optimization
  153. !     "-Oacegils /Gs" for all files (regcomp.c has special case code to change
  154. !     the aliasing optimizations).
  155.   
  156. !     Generally, you follow the instructions given above to compile and build
  157. !     Perl 4.0 for DOS.  I used the output of SunOS yacc run on perly.y,
  158. !     without modification, but I expect both Bison and Berkeley-YACC will work
  159. !     also.  From inspection of the generated code, however, I believe AT&T
  160. !     derived YACC produces the smallest tables, i.e. uses the least memory.
  161. !     This is important for a 300K executable file.
  162.   
  163. ! 2. Editing in-place.
  164.   
  165. !     You will need the file suffix.c from the os2 subdirectory -- it will
  166. !     create a backup file with much less danger for DOS.
  167.   
  168. ! 3. A "Smarter" chdir() function.
  169.   
  170. !     I have added to the DOS version of Perl 4.0 a replacement chdir()
  171. !     function.  Unlike the "normal" behavior, it is aware of drive letters
  172. !     at the start of paths for DOS.  So for example:
  173.   
  174. -     perl_chdir( "B:" )      changes to the default directory, on drive B:
  175. -     perl_chdir( "C:\FOO" )  changes to the specified directory, on drive C:
  176. -     perl_chdir( "\BAR" )    changes to the specified directory on the
  177. -                             current drive.
  178.   
  179. ! 4. *.BAT Scripts as Perl scripts
  180.   
  181. !     The strategy described above for turning a Perl script into a *.BAT
  182. !     script do not work.  I have been using the following lines at the
  183. !     beginning of a Perl *.BAT script:
  184.   
  185. !         @REM=(qq!
  186. !         @perl -S %0.bat %1 %2 %3 %4 %5 %6 %7 %8 %9
  187. !         @goto end !) if 0 ;
  188.   
  189. !     and the following at the end of the *.BAT script:
  190.   
  191. !         @REM=(qq!
  192. !         :end !) if 0 ;
  193.   
  194. !     If you like, with the proper editor you can replace the four '!'
  195. !     characters with some untypeable character, such as Ctrl-A.  This will
  196. !     allow you to pass any characters, including ".." strings as arguments.
  197.   
  198. ! 4. Things to Come
  199.   
  200. !      *  Better temporary file handling.
  201. !      *  A real Makefile -- Len Reed has one for Dmake 3.6
  202. !      *  Swapping code -- swaps most of Perl out of memory (to EMS, XMS or
  203. !     disk) before running a sub-program or pipe.
  204. !      *    MKS command line support, both into Perl, and to other programs
  205. !     spawned by Perl.
  206. !      *    Smarter pipe functions, not using COMMAND.COM.
  207.   
  208.   
  209. !                     Tom Dinger
  210. !                     tdinger@East.Sun.COM
  211. !                     Martch 18, 1991
  212. --- 1,262 ----
  213. !                       Notes on MS-DOS Perl
  214. !                 Len Reed <holos0!lbr@gatech.edu>
  215. !                          September, 1991
  216.   
  217.   
  218. ! Note: the documentation relating to using MS-DOS perl has been
  219. ! incorporated into the main manual.  See the section below on the
  220. ! manual.
  221.   
  222. ! Copying
  223. ! -------
  224. ! MS-DOS perl may be distributed under the terms of the Gnu public
  225. ! license or the artistic license.  You should have received copies
  226. ! of the files License and Artistic.
  227.   
  228.   
  229. ! Warranty
  230. ! --------
  231. ! This is free software.  It comes with no warranty of any kind.
  232.   
  233.   
  234. ! Obtaining the Source Code
  235. ! -------------------------
  236.   
  237. ! The standard perl source may be obtained from numerous public
  238. ! archive sources, and is available for anonymous ftp from
  239. ! <jpl-devvax.Jpl.Nasa.Gov>.  The MS-DOS changes incorporated into
  240. ! this version are not yet publically available, but should be
  241. ! soon.
  242.   
  243. ! Carriage-Return/Line-feed Fixup
  244. ! -------------------------------
  245. ! This package has been back and forth from Unix to MS-DOS many
  246. ! times.  If your MS-DOS text files, e.g., a manual or batch file,
  247. ! are missing the carriage returns, the following will insert them:
  248.   
  249. ! a    perl -i.bak -pe ";" file [file ...]
  250.   
  251. ! The ";" is a null perl script, the fixup is accomplished by
  252. ! reading a text file (which converts CR/LF ==> LF but passes LFs
  253. ! unmolested) and writing it (which converts LF==>CR/LF).
  254.   
  255.   
  256. ! Functionality
  257. ! -------------
  258. ! Several standard perl commands are not supported by MS-DOS perl
  259. ! for this simple reason that MS-DOS does not support many basic
  260. ! Unix functions like fork(), pipe(), and wait().  Use of these
  261. ! functions and many other like them will result in a fatal error. 
  262. ! See the manual for details.  All text processing features are
  263. ! intact.
  264.   
  265. ! The other limiting factor in using MS-DOS perl is memory.  The
  266. ! executable takes over 300 K-bytes before it starts calling
  267. ! malloc().  And it loves to call malloc().  You'll need 640K.  An
  268. ! 80286 with MS-DOS 5.0 running in high memory will help.  If you
  269. ! have an 80386 perl will find and use "upper memory" if available. 
  270. ! (Refer to Microsoft's documentation on XMS and MS-DOS 5.0.)
  271.   
  272. ! Subprocesses are always run to completion, since MS-DOS doesn't
  273. ! support multi-tasking.  Pipes are emulated by using temporary
  274. ! files.  MS-DOS perl can swap itself to disk (ideally a RAM disk
  275. ! in extended or expanded memory) so that the subprocess has space
  276. ! to run.
  277.   
  278. ! MS-DOS perl is compatible with the MKS toolkit: it can pass and
  279. ! receive extended argument lists to/from MKS tools.
  280.   
  281. ! To read and write binary files, use the binmode command.  (See
  282. ! the manual.)
  283.   
  284. ! The chdir function has been enhanced to allow changing the drive
  285. ! and/or the directory.
  286.   
  287. ! The Gnu version of dbm (gdbm) has been added to MS-DOS perl.
  288.   
  289. ! The perl debugger works as described in the manual, but it takes
  290. ! a lot of memory, so you won't be able to use it to debug any
  291. ! complicated.  (Bit of a Catch-22, I'm afraid.)
  292.   
  293.   
  294. ! Things To Do
  295. ! ------------
  296. ! The globbing for non-MKS users is pretty bad: the Microsoft
  297. ! globbing routines are used, and they're pretty primitive.
  298.   
  299. ! Some users have expressed an interest in 4DOS argument-passing
  300. ! compatibility.
  301.   
  302. ! Network communication (sockets) is not implemented.  There's a
  303. ! need for a freely distributable sockets library that works with a
  304. ! variety of network cards.
  305.   
  306. ! The exec() function is poorly implemented.  Without forks it's
  307. ! not too useful, and hence the considerable work required to make
  308. ! it function properly has been repeatedly put off.
  309.   
  310. ! MS-DOS perl takes too much memory.  There's a lot of code that
  311. ! doesn't do anything useful under MS-DOS but that is nevertheless
  312. ! compiled in.
  313.   
  314. ! I'm convinced that the exec-swapping code is not general enough
  315. ! for the worst case.  (That code was adapted from Dennis Vadura's
  316. ! dmake program.)  There may also be some memory leakage due to
  317. ! bugs in Microsoft's malloc library code.
  318.   
  319. ! For the truly ambitious, perl could be ported to gcc for i386 MS-
  320. ! DOS.  It could then run in 32-bit mode with large amounts of
  321. ! memory.  That would be a big project and really should use this
  322. ! port only as a basepoint: it should remain separate.  Any
  323. ! takers? :-)
  324.   
  325. ! See also Wishlist.dds.
  326.   
  327.   
  328. ! The Perl Manual
  329. ! ---------------
  330. ! If you got this file as part of the complete perl source
  331. ! distribution, you can make one of three manuals from the n/troff
  332. ! manual source: the standard Unix manual, an MS-DOS manual, or a
  333. ! combined Unix/MS-DOS manual.  Near the top of that file there's a
  334. ! string register that gets set to 'unix', 'msdos', or 'both'.  The
  335. ! 'unix' version has little mention of MS-DOS, the 'both' version
  336. ! includes additional commentary on MS-DOS and a section on "MS-DOS
  337. ! Considerations."  The 'msdos' version omits large sections of the
  338. ! standard manual that are not relevant to MS-DOS: every command is
  339. ! mentioned, but many simply note that they are not supported on
  340. ! MS-DOS.
  341.   
  342. ! If you got this file as part of an MS-DOS executable kit, you
  343. ! should have received a formatted manual in that kit: perldos.man.
  344. ! This manual contains simple highlighting in the form of boldface
  345. ! and underlining accomplished by backspacing.  There is a one-line
  346. ! script in the eg directory (nohigh.bat) that will remove the
  347. ! highlighting.
  348.   
  349. !      perl -p eg/nohigh.bat perldos.man > perldos.van
  350.   
  351. ! This will create perldos.van without highlighting.
  352.   
  353. ! Only the perl.exe file is needed for this script; it doesn't
  354. ! require a full installation of perl.
  355.   
  356. ! The versions of the manual that include MS-DOS commentary are not
  357. ! major re-writes; many of the examples have Unixisms that won't
  358. ! work on MS-DOS without some changes.
  359.   
  360. ! Beware that the "Camel" book, the only text on perl, barely
  361. ! mentions MS-DOS.  Nevertheless, this book should prove useful to
  362. ! the MS-DOS perl programmer.
  363.   
  364.   
  365. ! Installing MS-DOS Perl
  366. ! ----------------------
  367. ! Put perl.exe into a directory in your PATH.  Put perlglob.exe
  368. ! into that directory, too.  (Not needed for MKS users.)  If you
  369. ! wish to use the -P switch, copy doscpp.pl to a library directory. 
  370. ! (If you don't have Microsoft C 6.0 you'll have to edit this
  371. ! file.)  If you want to use the perl debugger, copy perldb.pl to
  372. ! the library directory, too.  Set up your environment as explained
  373. ! in the manual.
  374.   
  375. ! Building MS-DOS Perl from the Source
  376. ! ------------------------------------
  377. ! Apply the patches to the standard 4.019 source.
  378.   
  379. ! This code will compile only on Microsoft C, 5.0, 5.1, or 6.0. 
  380. ! The last of these produces the best code.  (It may be possible to
  381. ! cross-compile from SCO Xenix or Unix, since these cross-compilers
  382. ! are close relatives of the Microsoft compilers.)  The makefile is
  383. ! specific to Dennis Vadura's dmake program; if you don't have
  384. ! this, get it.  (See the makefile for the ftp address.)  There are
  385. ! batch files build5.bat and build6.bat to build perl.exe with
  386. ! Microsoft C 5.x and 6.0, respectively, if you don't have dmake.
  387.   
  388. ! If you wish to include gdbm, you'll have to obtain it.  Be sure
  389. ! to get the MS-DOS version.  I used version 1.4, with MS-DOS
  390. ! patches by Thorsten Ohl <td12@@ddagsi3.bitnet>.  Build the
  391. ! library (LGDBM.LIB) and copy it to the directory with the
  392. ! compiler libraries.  Copy the files "ndbm.h" and "gdbmdefs.h" to
  393. ! the compiler include file directory.  Enable the GDBM option in
  394. ! the makefile or edit the batch script or the config.h file to
  395. ! define HAS_NDBM.  Do not copy any other gdbm header files: in
  396. ! particular, "extern.h" will conflict with perl's extern.h.
  397.   
  398. ! Don't run Configure for MS-DOS: a pre-made config.h file is found
  399. ! in the msdos subdirectory.
  400.   
  401. ! Edit the makefile at the top to select the options you need.  (Or
  402. ! edit the batch file, using the makefile as a guide.)  The
  403. ! makefile will attempt to run BISON to create perly.c and perly.h
  404. ! from perly.y.  You can instead import your Unix-made version of
  405. ! these files.  (These are independent of platform, so you don't
  406. ! need to do anything to the Unix versions.  If using Unix yacc, be
  407. ! sure to copy over the version that had perlyfixer.sh run against
  408. ! it.)
  409.   
  410. ! Build perl.exe in the msdos subdirectory.
  411.   
  412. ! You'll need free XMS memory to run the Microsoft Codeview
  413. ! debugger on perl.
  414.   
  415.   
  416. ! Running the Test Suite
  417. ! ----------------------
  418. ! This section applies only if you're building MS-DOS perl from the
  419. ! source.  The test suite has been altered to run under MS-DOS. 
  420. ! Tests that aren't relevant under MS-DOS are if'ed around, so all
  421. ! tests should pass.  You'll need a lot of Unix-like tools (e.g.,
  422. ! rm); I used the MKS toolkit.  Copy perl.exe into the "t"
  423. ! directory.  Set up the environment and install doscpp.pl.
  424. ! You can't just run "perl test" since you'll run out of memory. 
  425. ! Try running each directory of tests, e.g.,
  426. !     ./perl test base/*.t"
  427. ! It may be necessary to break this even finer, some of the
  428. ! directories have a lot of tests.
  429. ! History of MS-DOS Perl
  430. ! ----------------------
  431. ! Larry Wall wrote perl, and continues to enhance it.  While he has
  432. ! done no direct work on MS-DOS perl, most of the code in MS-DOS
  433. ! perl is his since most of the code concerns portable features.
  434. ! Perl was originally ported to MS-DOS by Diomidis Spinellis.  His
  435. ! code was distributed with version 3, patch level 18 (3.018). 
  436. ! This was in April, 1990.
  437. ! Len Reed's executable version based upon 3.041 source with
  438. ! considerable enhancements was posted to USENET
  439. ! comp.binaries.ibm.pc in November, 1990.  This version included
  440. ! considerable minor bug fixes, swapping to disk while running
  441. ! subprocesses, "smarter" subprocesses (i.e., don't use COMMAND.COM
  442. ! if you don't need it), MKS toolkit compatibility, support for
  443. ! the -P switch, enhanced chdir semantics, and enhanced support for
  444. ! the -i switch.  (The last two of these due to Tom Dinger.)
  445. ! Tom Dinger cleaned up the released MS-DOS source code after perl
  446. ! 4.x came out.  By 4.010, he had put the following into the
  447. ! standard sources: enhanced chdir, enhanced -i support, several
  448. ! bug fixes.  He also created the msdos/config.h file.
  449. ! In September 1991, I (Len Reed) added the functions that were in
  450. ! my 3.041 version that hadn't been incorporated into the standard
  451. ! 4.010 source: notably swapping, smarter subprocesses, support
  452. ! for -P, and MKS compatibility.  I fixed some minor bugs.  I added
  453. ! gdbm support.  I altered the test suite to work with MS-DOS.  I
  454. ! put MS-DOS support into the main manual and reworked the other
  455. ! documentation, including this file.
  456. ! The Authors
  457. ! -----------
  458. ! Larry Wall         <lwall@netlabs.com>
  459. ! Diomidis Spinellis <dds@cc.ic.ac.uk>
  460. ! Len Reed           <holos0!lbr@gatech.edu>
  461. ! Tom Dinger         <tdinger@East.Sun.Com>
  462. ! The address for Diomidis Spinellis may be out of date.
  463.